window: sort icons before adding to _NET_WM_ICON
authorRay Strode <rstrode@redhat.com>
Thu, 1 Aug 2019 20:28:00 +0000 (16:28 -0400)
committerRay Strode <rstrode@redhat.com>
Thu, 1 Aug 2019 20:48:58 +0000 (16:48 -0400)
commit1612e38cdaba54fb6a88c333be7a148110bd1748
treea2e08400993ed0af2d49d24393259f7a06f7a7ea
parent176ab784dc1964830ddcfdd3159c5db3a6d5cbe3
window: sort icons before adding to _NET_WM_ICON

When processing the list of icons for a window to add them to
_NET_WM_ICON gdk_x11_surface_set_icon_list only adds as many
icon sizes as will fit within X protocol limits.

It achieves this by keeping a running total of the number of
bytes taken up by icons already processed and bails as soon
as it goes over the limit.

The problem is, one 512x512 icon is already over the limit,
and so no icons will get added at all if the first icon in
list is 512x512.

Indeed, the code seems to assume the list is sorted from smallest
icon to biggest icon.

This commit changes the caller to sort the list.
gtk/gtkwindow.c